package com.blog.entity;

import java.util.Date;

/**
 * 文章实体类 - 对应数据库article表
 */
public class Article {
    private int id;             // 文章ID
    private String title;       // 标题
    private String content;     // 内容
    private int categoryId;     // 分类ID
    private int userId;         // 作者ID
    private int viewCount;      // 浏览次数
    private int isPublished;    // 是否发布(0-草稿,1-已发布)
    private Date createdTime;   // 创建时间
    private Date updatedTime;   // 更新时间

    // 扩展字段（非数据库字段，用于页面展示）
    private String categoryName; // 分类名称
    private String authorName;   // 作者昵称

    // 无参构造函数
    public Article() {}

    // Getter和Setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getViewCount() {
        return viewCount;
    }

    public void setViewCount(int viewCount) {
        this.viewCount = viewCount;
    }

    public int getIsPublished() {
        return isPublished;
    }

    public void setIsPublished(int isPublished) {
        this.isPublished = isPublished;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    @Override
    public String toString() {
        return "Article{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", categoryId=" + categoryId +
                ", userId=" + userId +
                ", isPublished=" + isPublished +
                '}';
    }
}